package com.java.imauoj.sercive;

import com.java.imauoj.mapper.RoleMapper;
import com.java.imauoj.moudel.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleService {

    @Autowired
    private RoleMapper mapper;

    public Role getRole(int role_id){
        Role role = mapper.getRole(role_id);
        return role;
    }

    public Role deleteRole(int role_id){
        Role role1 = mapper.getRole(role_id);
        mapper.deleteRole(role_id);
        return role1;
    }

    public Role addRole(Role role){
        mapper.addRole(role);
        Role role1 = mapper.getRole(role.getRole_id());
        return role1;
    }

    public Role updateRole(Role role){
        mapper.updateRole(role);
        Role role1 = mapper.getRole(role.getRole_id());
        return role1;
    }

    public List<Role> getRoleList(){
        List<Role> list = mapper.getRoleList();
        return list;
    }
}
